# -*-coding:utf-8 -*-
#
# Created on 2020/3/3, by felix
#

from django.db import models
from base.models import BaseModel


# 100 基本的增删改查
class CommandInfo(BaseModel):
    """command info"""
    name = models.CharField(verbose_name='命令名称', max_length=50)  # null blank 去掉也会影响，数据库迁移文件
    # name = models.CharField(verbose_name='命令名称', max_length=50, null=True, blank=True)  # 序列化时候，会跳过该字段
    desc = models.CharField(verbose_name='命令描述', max_length=256, null=True, blank=True)
    version = models.CharField(verbose_name="命令版本", max_length=50, null=True, blank=True)
    created_by = models.CharField(verbose_name="创建人", max_length=50, null=True, blank=True)
    sex_choices = ((1, "男"),
                   (2, "女"),
                   (3, '未知'))
    sex = models.IntegerField(verbose_name="性别", choices=sex_choices, default=1)

    class Meta:
        db_table = 'crud_command_info'

    def __str__(self):  # 声明对象的时候，返回name
        return self.name


class Owner(BaseModel):
    """负责人表"""
    name = models.CharField(verbose_name="姓名拼音", max_length=64)
    nickname = models.CharField(verbose_name="姓名中文", max_length=64)
    sex_choices = ((1, "男"),
                   (2, "女"))
    sex = models.IntegerField(verbose_name="性别", choices=sex_choices, default=1)
    pwd = models.CharField(verbose_name="域密码", max_length=128)
    phone = models.CharField(verbose_name="手机号", max_length=64)
    weixin = models.CharField(verbose_name="微信号", max_length=128, null=True, blank=True)
    work_email = models.EmailField(verbose_name="工作邮箱", max_length=50)
    email = models.EmailField(verbose_name="个人邮箱", max_length=50, null=True, blank=True)

    class Meta:
        db_table = 'crud_command_owner'

    def __str__(self):  # 声明对象的时候，返回name
        return self.name
